﻿using System;

using NHibernate;
using NHibernate.Cfg;

namespace DflyingForum.Core.Data.NHHelper
{
    public class SessionManager
    {
        public static readonly ISessionFactory SessionFactory;

        static SessionManager()
        {
            SessionFactory = new Configuration().Configure().BuildSessionFactory();
        }

        public static ISession OpenSession()
        {
            return SessionFactory.OpenSession();
        }

        public static ISession GetCurrentSession()
        {
            return SessionFactory.GetCurrentSession();
        }
    }
}
